;;; firemacs-browser.el --- 

;; Copyright 2006 Lukas Loehrer
;;
;; Author: loehrerl [at] gmx [dot] net
;; Version: $Id: firemacs-browser.el,v 0.0 2006/10/14 19:17:21 luke Exp $
;; Keywords: 
;; X-URL: not distributed yet

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

;;; Commentary:

;; 

;; Put this file into your load-path and the following into your ~/.emacs:
;;   (require 'firemacs-browser)

;;; Code:

(provide 'firemacs-browser)
(eval-when-compile
  (require 'cl))

(require 'mozremote)
(require 'mozremote-object)

(defun firemacs-browser-load-url-in-new-window (handler url)
  "Loads url in new window, passes window to handler."
  (let* ((win (mozremote-call-sync "Browsing" "getNewBrowserWindow"))
		 (win-handler
		  ;; create lexical closure
		  (lexical-let ((win win)
						(handler handler))
			(lambda (msg)
			  (message "Title: %s" msg)
			  ;; We ignore the return value of "loadURL" here (probably not wise)
			  (funcall handler win)))))
;	(sleep-for 2)
	(mozremote-object-call-method win-handler win "loadURL" url)
	win))


;;{{{  emacs local variables

;;; local variables:
;;; folded-file: t
;;; byte-compile-dynamic: t
;;; end:

;;}}}

;;; firemacs-browser.el ends here
